package com.press.services;

import com.press.bean.UserBean;
import com.press.mapper.PersonalDataMapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * Created by haocongshun on 2016/10/5.
 */
@Service("personalDataService")
public class PersonalDataService {
    @Resource(name = "personalDataMapper")
    private PersonalDataMapper personalDataMapper;

    public PersonalDataMapper getPersonalDataMapper() {
        return personalDataMapper;
    }

    public void setPersonalDataMapper(PersonalDataMapper personalDataMapper) {
        this.personalDataMapper = personalDataMapper;
    }
    public UserBean updateAdmin(UserBean admin){
        if(personalDataMapper.updateAdmin(admin)){
            return personalDataMapper.getUserById(admin.getUser_id());
        }else {
            return null;
        }
    }
    public UserBean getAdmin(){
        UserBean admin = personalDataMapper.getAdmin();
        if(admin!=null){
            admin.setUser_password(null);
            return admin;
        }
        return null;
    }
    public UserBean getAdminIntroduction(){
        return personalDataMapper.getAdminIntroduction();
    }
    public boolean setAdminIntroduction(UserBean admin){
        return personalDataMapper.setAdminIntroduction(admin);
    }

}
